﻿using System;

using enyo;

namespace com.RexToy
{
    public class EngyView : ConverterView
    {
        private object[] components = new object[]{ 
            new {kind= ControlKind.BasicScroller, 
                components=new object[] {
                    new {kind=ControlKind.RowGroup, 
                        components= new object[]{
				            new {name= "w", richContent= false, kind = ControlKind.Input, onblur="blur",
                                    components=new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Watt")}
                                    }
                            },
                            new {name= "hp", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components= new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Horse Power")}
				                    }
                            },
				            new {name= "kc", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Kcal/s")}
				                   }
				            }
			            }                    
		            }      
                }
            }
        };

        public override void Create()
        {
            this.Inherited(Arguments.Value);

            this.units = new string[] { "w", "hp", "kc" };
            this.baseUnit = "w";

            this.fomular = new object();
            this.fomular["w->w"] = "w";
            this.fomular["w->hp"] = "w/735.2941";
            this.fomular["hp->w"] = "hp*735.2941";
            this.fomular["w->kc"] = "w/4184.1004";
            this.fomular["kc->w"] = "kc*4184.1004";
        }
    }
}
